<?php
namespace app\admin\controller;
use cmf\controller\AdminBaseController;
use app\admin\model\OrderModel;
use think\Request;
use think\Validate;

class OrderController extends AdminBaseController
{
	//待处理预约
	public function index()
	{
		$orderModel = new OrderModel();
		$data = $orderModel->getDataList(0);
		$this->assign([
            "data"=>$data,
            "page"=>$data->render()
        ]);
        return $this->fetch();
	}
	//已处理预约
	public function handle()
	{
		$orderModel = new OrderModel();
		$data = $orderModel->getDataList(1);
		$this->assign([
            "data"=>$data,
            "page"=>$data->render()
        ]);
        return $this->fetch();
	}
	//预约信息详情
	public function read($id)
	{
		$model = new OrderModel();
        $data = $model->getOrderInfo($id);
        $this->assign([
            "data"=>$data
        ]);
        return $this->fetch();
	}
	//问诊单详情
	public function wenzhen($id)
	{
		$model = new OrderModel();
		$data = $model->getWenzhenInfo($id);
        $this->assign([
            "data"=>$data
        ]);
        return $this->fetch();
	}
	//处理预约
	public function delete($id)
	{
		$model = new OrderModel();
		if($model->dodel($id)){
            $this->success("处理成功");
        }else{
            $this->error('处理失败');
        }
	}
	//问诊信息列表
	public function question()
	{
		$model = new OrderModel();
		$data = $model ->getQuestions();
		$this->assign([
            "data"=>$data,
             "page"=>$data->render()
        ]);
        return $this->fetch();
	}

}